﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using AGMLite.Common;
using AGMLite.BaseClass;
using HPAGMRestAPIWrapper;
using AGMLite.ViewModelClass;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Net;
using System.ComponentModel;
using System.Threading;
using System.Windows.Threading;

namespace AGMLite.Windows
{
    /// <summary>
    /// Interaction logic for EntityListWindow.xaml
    /// </summary>
    public partial class EntityListWindow : Window
    {
        public EntityListWindow()
        {
            InitializeComponent();            
        }
    }    

    public class ItemEntityNewConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            BitmapImage img = new BitmapImage();
            bool isnew = (bool)value;

            if (isnew)
                img = new BitmapImage(new Uri("pack://application:,,,/AGMLite;component/images/new.png"));

            return img;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

    public class ItemEntityHealthConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            BitmapImage img = new BitmapImage();
            int health = (int)value;

            switch(health)
            {
                case 0: // Health
                    img = new BitmapImage(new Uri("pack://application:,,,/AGMLite;component/images/health-good.png"));
                    break;
                case 1: // Warn
                    img = new BitmapImage(new Uri("pack://application:,,,/AGMLite;component/images/health-warn.png"));
                    break;
                case 2: // Problem
                    img = new BitmapImage(new Uri("pack://application:,,,/AGMLite;component/images/health-problem.png"));
                    break;
            }
                

            return img;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
